Skip to content

Conversation

@gerblesh
Copy link

Fixes systemd-boot signing, before the systemd-boot binary was signed on the buildroot but not on the target image, resulting in an unbootable image with secure boot enabled and the proper keys enrolled. This PR fixes it by first signing the systemd-boot on image (assumes it is installed), copying it over to the final image, then computing the digest, and then finally signing and creating the UKI with a different multi stage build. Definitely a little jank and #1498 does look like a better solution in the long term, however this at least gets the image in a bootable state on secure boot and allows for testing the secure boot in VMs. Would be happy to take a stab at proper image building UX but I'm not sure if that already has work done or if y'all have a particular vision in mind for the build system

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively addresses the systemd-boot signing issue for sealed images, which is a great step forward for secure boot testing. The introduction of a dedicated Dockerfile.sdboot for the signing process is a clean approach. My review includes a few suggestions to enhance the new Dockerfile's robustness and readability, and a note on a temporarily disabled lint check.

@gerblesh gerblesh force-pushed the sign-sdboot branch 2 times, most recently from 6bd32cd to 4ffe2f6 Compare December 1, 2025 16:23
@gerblesh
Copy link
Author

gerblesh commented Dec 1, 2025

added automatic key enrollment (with sdboot) in bootc install but one problem is that in Dockerfile.sdboot we need efitools for signing and preparing the certs for enrollment, which centos/RHEL doesn't seem to package. Let me know if it would also make sense to break out these changes (autoenrollment)

Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for starting this! Basically let's get the buildsystem rework in to properly sign systemd-boot first, and then look at the key autoenrollment as a distinct second step.

I can take a look at the first one, starting from the work here if you prefer!

@gerblesh
Copy link
Author

gerblesh commented Dec 2, 2025

alright split out the code for autoenroll to just focus on signing systemd-boot in CI

@gerblesh
Copy link
Author

gerblesh commented Dec 2, 2025

#1818 new PR for auto enrollment here

Copy link
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for starting this! Is it OK if I try some force pushing to this PR and we co-author?

@gerblesh
Copy link
Author

gerblesh commented Dec 2, 2025

Thanks again for starting this! Is it OK if I try some force pushing to this PR and we co-author?

Yeah go for it, just was cleaning up the comments and extra mounts

@cgwalters
Copy link
Collaborator

OK what this is blocking on is I think we're not detecting the OVMF firmware correctly in bcvk on Debian derivatives. Looking at that

@cgwalters cgwalters force-pushed the sign-sdboot branch 4 times, most recently from 1505773 to 65e28b7 Compare December 10, 2025 20:32
cgwalters and others added 2 commits December 10, 2025 16:42
This would really be fixed by having `boot container ukify`.

Signed-off-by: Colin Walters <walters@verbum.org>
Signed-off-by: Gareth Widlansky <gareth.widlansky@proton.me>
Signed-off-by: Colin Walters <walters@verbum.org>
@cgwalters cgwalters force-pushed the sign-sdboot branch 2 times, most recently from 34bdaf6 to 92fa74b Compare December 11, 2025 00:29
println!(" Image: {}", image);
println!(" VM name: {}\n", vm_name);

// Detect if this is a sealed image and build firmware args accordingly
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dedup this code

format!("--secure-boot-keys={}", sb_keys_dir),
]
} else {
if is_sealed {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fallback doesn't make sense

@cgwalters

This comment was marked as off-topic.

cgwalters

This comment was marked as outdated.

@cgwalters
Copy link
Collaborator

Sorry, those comments were a misfire from my non-sandboxed agent; I'm going to ensure that doesn't happen again.

Main goal is to reduce signing logic duplication between the systemd-boot
and UKI generation.

However, this quickly snowballed into wanting to actually verify
by providing a custom secure boot keys to bcvk that things worked.
This depends on bootc-dev/bcvk#170

Now as part of that, I ran into what I think are bugs in pesign;
this cuts things back over to using sbsign. I'll file a tracker for that
separately.

Finally as part of this, just remove the TMT example that builds
a sealed image but doesn't actually verify it works - it's already
drifted from what we do outside here. Ultimately what we need
is to shift some of this into the Fedora examples and we just
fetch it here anyways.

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
@cgwalters cgwalters enabled auto-merge (rebase) December 11, 2025 16:56
@cgwalters cgwalters disabled auto-merge December 11, 2025 16:56
@cgwalters
Copy link
Collaborator

This one is ready to merge I think but as always a lot of potential followup here.

Hum looks like the rawhide failures might be a nushell regression/semantic change, but not related.

@cgwalters
Copy link
Collaborator

@jmarrero you're assigned reviewer looks like

@cgwalters
Copy link
Collaborator

(Technically I can merge this since it's someone else's PR but I added quite a lot of code here so someone else should at least do a medium-level review)

Copy link
Contributor

@jmarrero jmarrero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@cgwalters cgwalters merged commit 6f69534 into bootc-dev:main Dec 11, 2025
39 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants